#include "CScaleCommand.h"
#include "CUserInterface.h"
#include "CLevelEditor.h"
#include "ISceneManager.h"
#include "ISceneNode.h"
#include "CSceneObject.h"

extern CGlobals* g;
extern CUserInterface* ui;
extern CLevelEditor* editor;

CScaleCommand::CScaleCommand (int id, vector3df oldScale, vector3df newScale)
{
	m_id = id;
	m_oldScale = oldScale;
	m_newScale = newScale;
	stringw name = editor->getSceneObjectFromID(id)->m_UserData->getAttributeAsStringW("Name");
	setDescription(stringw(L"scale ") + name + L"(" + stringw(id) + L")");
}

void CScaleCommand::redo ()
{
	g->sceneManager->getSceneNodeFromId(m_id)->setScale(m_newScale);
}

void CScaleCommand::undo ()
{
	g->sceneManager->getSceneNodeFromId(m_id)->setScale(m_oldScale);
}
